package experiment1.closestpoints;

import util.Util;

import java.util.*;

public class Main {
    public static void main(String[] args) {
        ClosestPoints closestPoints1 = new ClosestPoints1();
        ClosestPoints closestPoints2 = new ClosestPoints2();
        ClosestPoints closestPoints3 = new ClosestPoints3();
        Scanner scanner = new Scanner(System.in);

        System.out.println("请输入产生的点的个数和维度（1维或2维）:例 4 2");
        while (true) {
            int n = scanner.nextInt();
            int dimension = scanner.nextInt();

            if (n == -1){
                break;
            }

            Point[] points = new Point[n];

            for (int i = 0; i < n; i++) {
                if (dimension == 1) {
                    points[i] = new Point(Util.NonRepeatingRandDouble(n));
                } else {
                    points[i] = new Point(Util.NonRepeatingRandDouble(n), Util.NonRepeatingRandDouble(n));
                }
            }
            if(n <= 100){
                System.out.println(Arrays.toString(points));

            }

            closestPoints1.solve(points);
            closestPoints2.solve(points);
            closestPoints3.solve(points);

            System.out.println(closestPoints1.result());
            System.out.println(closestPoints2.result());
            System.out.println(closestPoints3.result());

            Util.set.clear();
        }
    }
}
